package org.gnu.williamjoy.marycircles.model;

public class Circle extends Point {

    public int radius;
    public int color;
    public int mass;

    public Circle(float x, float y, int radius, int color) {
        super(x, y);
        this.radius = radius;
        this.color = color;
        this.mass = radius * radius;
    }

    public int getRadius() {
        return radius;
    }

    public void setRadius(int radius) {
        this.radius = radius;
        this.mass = radius * radius * radius;
    }

    public int getColor() {
        return color;
    }

    public void setColor(int color) {
        this.color = color;
    }

    public float distanceSquare(Circle another) {
        return (this.x - another.x) * (this.x - another.x)
                + (this.y - another.y) * (this.y - another.y);
    }

    public boolean collisionDetect(Circle another) {
        return this.distanceSquare(another) <= (this.radius + another.radius)
                * (this.radius + another.radius);
    }

    @Override
    public String toString() {
        return "Circle [radius=" + radius + ", color=" + color + ", x=" + x
                + ", y=" + y + "]";
    }

}
